package com.woniuxy.springbootthymeleaf.config;

import com.woniuxy.springbootthymeleaf.interceptor.CustomInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author linke
 * @version 1.0
 * @className: InterceptorConfig
 * @description: 拦截器配置类 需要实现WebMvcConfigurer
 * @date 2021/11/17 1:41
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器 可以多个拦截器注册
        registry.addInterceptor(new CustomInterceptor()).addPathPatterns("/user/**");
    }
}
